﻿using Accouting804.Setting;
using Accouting804.ViewModels.AccountViewModels;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Accouting804.Views
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class AccountDetailPage : ContentPage
    {

        public AccountDetailViewModel ViewModel { get; set; }

        public AccountDetailPage(AccountDetailViewModel viewModel)
        {
            this.ViewModel = viewModel;
            InitializeComponent();
            var connection = InitializeSetting.AccountConnection();
            var paymentMethods = connection.Table<PaymentMethod>().ToList();
            PaymentMethods = new ObservableCollection<PaymentMethod>(paymentMethods);
            Books = new ObservableCollection<Book>(connection.Table<Book>().ToList());
            Tags = new ObservableCollection<Tag>(connection.Table<Tag>().ToList());

            Categories = new ObservableCollection<Category>(connection.Table<Category>().ToList());
            BindingContext = this;
        }

        public ObservableCollection<PaymentMethod> PaymentMethods { get; private set; }
        public ObservableCollection<Book> Books { get; private set; }
        public ObservableCollection<Tag> Tags { get; private set; }
        public ObservableCollection<Category> Categories { get; private set; }
    }
}